#include <iostream>
#include <iomanip>

using namespace std;

int main(void)
{
    unsigned int n;

    while((cin>>n) && (n != 0))
    {
        int row, col;
        unsigned int max_num;
        unsigned int matrix[30][30] = {{0}};
        
        max_num = n*n;

        row = n-1;
        col = n/2;
        
        for(unsigned int num = 1; num < max_num+1; num++)
        {
            if (matrix[row][col] != 0)
            {
                row = (row - 2 + n)%n;
                col = (col - 1 + n)%n;
            }

            matrix[row][col] = num;
            
            row = (row + 1)%n;
            col = (col + 1)%n;
        }
        
        for(unsigned int i = 0; i < n; i++)
        {
            for(unsigned int j = 0; j < n; j++)
            {
                cout<<setw(3)<<matrix[i][j];
            }
            cout<<endl;
        }
        cout<<endl;
    }
    return 0;
}

